package com.jims.api.v1.controller.tj; /**
 * jims
 */

import com.jims.master.common.data.Message;
import com.jims.master.common.utils.SecurityUtil;
import com.jims.master.common.web.BaseController;
import com.jims.master.modules.sync.entity.ClinicMaster;
import com.jims.master.modules.tj.entity.TjHzConclusion;
import com.jims.master.modules.tj.entity.TjHzItem;
import com.jims.master.modules.tj.entity.TjHzRecord;
import com.jims.master.modules.tj.service.TjHzConclusionService;
import com.jims.master.modules.tj.service.TjHzItemService;
import com.jims.master.modules.tj.service.TjHzRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 体检客户基础信息Controller
 * @author ct
 * @version 2018-05-04
 */
@RestController
@RequestMapping(value = "/tjHzRecord")
public class TjHzRecordController extends BaseController {

	@Autowired
	private TjHzRecordService tjHzRecordService;
	@Autowired
	private TjHzItemService tjHzItemService;
	@Autowired
	private TjHzConclusionService tjHzConclusionService;

	/**
	 * @Title: tjHzRecordV100
	 * @Description: 根据身份证号查询体检列表
	 * @param idCard
	 * @return
	 * @author CT
	 * @date 2018/05/04 0017
	 * @throws
	 */
	@RequestMapping(value = "V100/tjHzRecordV100",method ={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public String tjHzRecordV100(@RequestParam(required = true)String idCard){
	/*	Map<String, Object> map = new HashMap<String, Object>();*/
		/*map.put("registList",registList);*/
		List<TjHzRecord> tjHzRecordList = tjHzRecordService.getRecordList(idCard);
		Message mes = new Message();
		mes.setData(tjHzRecordList);
		return SecurityUtil.encryptMsgData(mes);
	}

	/**
	 * @Title: tjHzRecord
	 * @Description: 根据身份证号查询体检列表
	 * @return
	 * @author jicunteng
	 * @date 2018/05/04 0017
	 * @throws
	 */
	@RequestMapping(value = "V100/tjHzRecord",method ={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public String tjHzRecord(@RequestParam(required = true)String recordNo) {
		/*Map<String, Object> map = new HashMap<String, Object>();
		map.put("registList",registList);*/
		TjHzRecord tjHzRecord = tjHzRecordService.getByRecordNo(recordNo);
		Message mes = new Message();
		mes.setData(tjHzRecord);
		return SecurityUtil.encryptMsgData(mes);
	}

	/**
	 * @Title: tjHzItemV100
	 * @Description: 根据体检编号查询体检小项结果
	 * @param recordNo
	 * @return
	 * @author CT
	 * @date 2018/05/05 0017
	 * @throws
	 */
	@RequestMapping(value = "V100/tjHzItemV100",method ={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public String tjHzItemV100(@RequestParam(required = true)String recordNo){
		Message mes = new Message();
		List<TjHzItem> itemList = tjHzItemService.getitemList(recordNo);
		mes.setData(itemList);
		return SecurityUtil.encryptMsgData(mes);
	}

	/**
	 * @Title: tjHzItemV100
	 * @Description: 根据体检编号查询科室及结论
	 * @param recordNo
	 * @return
	 * @author jicunteng
	 * @date 2018/05/10 0017
	 * @throws
	 */
	@RequestMapping(value = "V100/tjHzConclusion",method ={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public String tjHzConclusion(@RequestParam(required = true)String recordNo){
		Message mes = new Message();
		List<TjHzConclusion> ConclusionList = tjHzConclusionService.getByRecordNo(recordNo);
		mes.setData(ConclusionList);
		return SecurityUtil.encryptMsgData(mes);
	}

	/**
	 * @Title: tjHzItemV100
	 * @Description: 根据体检编号查询和科室编号查询item
	 * @param recordNo
	 * @return
	 * @author jicunteng
	 * @date 2018/05/10 0017
	 * @throws
	 */
		@RequestMapping(value = "V100/tjItemListByCode",method ={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public String tjHzConclusion(@RequestParam(required = true)String recordNo,String code){
		Message mes = new Message();
		List<TjHzItem> itemList = tjHzItemService.tjItemListByCode(recordNo,code);
		mes.setData(itemList);
		return SecurityUtil.encryptMsgData(mes);
	}

}